package com.luoran.car.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luoran.car.domain.SysCarCustomer;
import com.luoran.car.domain.customer.RegisterCustomer;
import com.luoran.car.service.SysCarCustomerService;
import com.luoran.car.mapper.SysCarCustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 路飞
* @description 针对表【sys_car_customer(客户表)】的数据库操作Service实现
* @createDate 2024-09-20 15:47:05
*/
@Service
public class SysCarCustomerServiceImpl extends ServiceImpl<SysCarCustomerMapper, SysCarCustomer>
    implements SysCarCustomerService{


    @Autowired
    SysCarCustomerMapper carCustomerMapper;

    @Override
    public SysCarCustomer selectLoginCustomer(String customerName) {
        return carCustomerMapper.selectLoginCustomer(customerName);
    }

    @Override
    public List<SysCarCustomer> customerList() {
        return carCustomerMapper.customerList();
    }

    @Override
    public Boolean customerDel(Integer id) {
        return carCustomerMapper.customerDel(id);
    }

    @Override
    public Boolean customerUpdata(SysCarCustomer carCustomer) {
        return carCustomerMapper.customerUpdata(carCustomer);
    }

    @Override
    public Boolean customerInsert(SysCarCustomer carCustomer) {
        return carCustomerMapper.customerInsert(carCustomer);
    }

    @Override
    public Boolean lockAccount(Integer id) {
        return carCustomerMapper.lockAccount(id);
    }

    @Override
    public Boolean unitAccount(Integer id) {
        return carCustomerMapper.unitAccount(id);
    }

    @Override
    public Boolean register(RegisterCustomer registerCustomer) {
        SysCarCustomer carCustomer = SysCarCustomer.builder()
                .customerName(registerCustomer.getUsername()).loginPassword(registerCustomer.getPassword())
                .email(registerCustomer.getEmail())
                .build();
        return carCustomerMapper.customerInsert(carCustomer);
    }

    @Override
    public SysCarCustomer selectSendEmail(String email) {
        return carCustomerMapper.selectSendEmail(email);
    }

    @Override
    public Boolean updataPassword(SysCarCustomer sysCarCustomer) {
        return carCustomerMapper.updataPassword(sysCarCustomer);
    }

}




